package cuiweiyou.headerrecycleview;


import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import java.util.ArrayList;
import java.util.List;

import cuiweiyou.headerrecycleview.adapter.FragmentAdapter;
import cuiweiyou.headerrecycleview.adapter.HeaderRcyvAdapter;
import cuiweiyou.headerrecycleview.bean.HeaderBean;
import cuiweiyou.headerrecycleview.bean.NormalBean;
import cuiweiyou.headerrecycleview.fragment.FragmentOne;

/**
 * www.gaohaiyan.com
 */
public class MainActivityViewpage extends AppCompatActivity {
    private List<NormalBean> mNormalList = new ArrayList<NormalBean>(); // 普通item的数据集
    private HeaderBean mHeaderBean;                                     // header的数据

    private LinearLayout activityMain;
    private ViewPager vp;
    private List<Fragment> fragmentList = new ArrayList<>();


    private HeaderRcyvAdapter mHeaderRcyvAdapter;
    private FragmentAdapter fragmentAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_viewpage);
        vp = (ViewPager) findViewById(R.id.vp);

        FragmentOne fragment1 = new FragmentOne(MainActivityViewpage.this,"1");
        FragmentOne fragment2 = new FragmentOne(MainActivityViewpage.this,"12");
        FragmentOne fragment3 = new FragmentOne(MainActivityViewpage.this,"123");
        fragmentList.add(fragment1);
        fragmentList.add(fragment2);
        fragmentList.add(fragment3);
        fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragmentList, "1");
        vp.setAdapter(fragmentAdapter);

    }

}
